<template>
    
</template>

<script>
//@see https://www.ruanyifeng.com/blog/2018/07/indexeddb.html
const DB_NAME = 'time-geek'
export default {
    name: 'indexeddb',
    data() {
        return {
            db: null,
        }
    },
    mounted() {
        
    },
    methods: {
        createDB() {
            let request = window.indexedDB.open(DB_NAME)

            request.onerror = function (event) {
                console.log('数据库打开报错', event);
            }

            request.onsuccess = function (event) {
                this.db = request.result;
                console.log('数据库打开成功');
            };

            request.onupgradeneeded = function (event) {
                this.db = event.target.result;
                console.log('数据库升级');
            }

        }
    }
}
</script>